package com.project.petLossSystem.mapper;

import com.project.petLossSystem.po.AddressCategory;
import com.project.petLossSystem.util.PageQueryUtil;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface AddressCategoryMapper {
    List<AddressCategory> addressCategoryList(PageQueryUtil pageQueryUtil);
    int addressCount(PageQueryUtil pageQueryUtil);
    AddressCategory getAddressByParentIdAndName(@Param("parentId") Integer parentId, @Param("addressName") String addressName); // 查重
    int insertAddress(AddressCategory addressCategory); // 只有父id、分类名、等级三个参数
    int insertAddresses(@Param("parentId") Integer parentId, @Param("addressLevel") Byte addressLevel, @Param("addressNames") List<String> addressNames);
    AddressCategory getAddressById(Integer addressId);
    List<Integer> getIdListByParentIds(List<Integer> addressIds); // 求子分类id
    int updateAddress(AddressCategory addressCategory); // 前端更新只修改name而已
    int updateDeletedByIds(List<Integer> addressIds);
    List<AddressCategory> getAddressesByParentId(@Param("parentId") Integer parentId); // 由父类id得子分类列表
    String getAddressNameById(@Param("addressId") Integer addressId);
}
